﻿using System;
using System.Collections.Generic;
using System.Text;

namespace XDesigner.AppFramework.Actions
{
    public abstract class AppAction 
    {
        public AppAction()
        {
        }

        private string _Name = null;

        public string Name
        {
            get
            {
                return _Name; 
            }
            set
            {
                _Name = value; 
            }
        }

        private string _Description = null;

        public string Description
        {
            get
            {
                return _Description; 
            }
            set
            {
                _Description = value; 
            }
        }

        private bool _Enabled = true;

        public virtual bool Enabled
        {
            get
            {
                return _Enabled; 
            }
            set
            {
                _Enabled = value; 
            }
        }

        private bool _Visible = true;

        public virtual bool Visible
        {
            get
            {
                return _Visible; 
            }
            set
            {
                _Visible = value; 
            }
        }

        private bool _Checked = false;

        public virtual bool Checked
        {
            get
            {
                return _Checked; 
            }
            set
            {
                _Checked = value; 
            }
        }


        private System.Windows.Forms.Shortcut intShortcut = System.Windows.Forms.Shortcut.None;
        /// <summary>
        /// 快捷键
        /// </summary>
        public virtual System.Windows.Forms.Shortcut Shortcut
        {
            get
            {
                return intShortcut;
            }
            set
            {
                intShortcut = value;
            }
        }

        /// <summary>
        /// 检查快捷键
        /// </summary>
        /// <param name="keyData">要检查的键盘值</param>
        /// <returns>是否是快捷键</returns>
        public virtual bool CheckShortcutKey(System.Windows.Forms.Keys keyData)
        {
            if (intShortcut != System.Windows.Forms.Shortcut.None)
            {
                return intShortcut == (System.Windows.Forms.Shortcut)keyData;
            }
            return false;
        }

        private System.Drawing.Image _Image = null;

        public virtual System.Drawing.Image Image
        {
            get
            {
                return _Image; 
            }
            set
            {
                _Image = value; 
            }
        }

        private AppFrameworkClass _Framework = null;

        public AppFrameworkClass Framework
        {
            get { return _Framework; }
            set { _Framework = value; }
        }
        public virtual void BeforeExecute()
        {
        }

        public virtual void Execute()
        {
        }

        public virtual void AfterExecute()
        {
        }
    }
}
